package com.fxwater.biz.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fxwater.biz.domain.FxwElementDataInfo;
import com.fxwater.biz.domain.StationElementInfo;
import com.fxwater.biz.mapper.StationElementMapper;
import com.fxwater.biz.service.IStationElementService;
import com.fxwater.common.constant.WaterConstants;
import com.fxwater.common.core.text.Convert;

@Service
public class StationElementServiceImpl implements IStationElementService {

	@Autowired
	private StationElementMapper stationElementMapper;
	
	@Override
	public List<StationElementInfo> selectStationElementInfoList(StationElementInfo stationElementInfo) {
		// TODO Auto-generated method stub
		return stationElementMapper.selectStationElementInfoList(stationElementInfo);
	}

	@Override
	public int removestationElementInfo(String ids) {
		// TODO Auto-generated method stub
		return stationElementMapper.removestationElementInfo(Convert.toStrArray(ids));
	}

	@Override
	public int editStationElementInfo(StationElementInfo stationElementInfo) {
//		stationElementInfo.setUpdateBy(ShiroUtils.getLoginName());
		return stationElementMapper.editStationElementInfo(stationElementInfo);
	}

	@Override
	public int addStationElementInfo(StationElementInfo stationElementInfo) {
		// TODO Auto-generated method stub
		return stationElementMapper.addStationElementInfo(stationElementInfo);
	}

	@Override
	public String checkSerialNumberUnique(StationElementInfo stationElementInfo) {
		int count = stationElementMapper.checkSerialNumberUnique(stationElementInfo);
		if( count > 0) {
			return WaterConstants.STATIONELEMENT_NUM_NOT_UNIQUE;
			
		}else {
			return WaterConstants.STATIONELEMENT_NUM_UNIQUE;
		}
	}

	@Override
	public List<FxwElementDataInfo> selectElementDataInfoList(FxwElementDataInfo fxwElementDataInfo) {
		// TODO Auto-generated method stub
		return stationElementMapper.selectElementDataInfoList(fxwElementDataInfo);
	}


}
